import request from '@/utils/request';
import dart from 'highlight.js/lib/languages/dart';

// 查询设备列表
export function list(query) {
  return request({
    url: '/iot/device/list',
    method: 'get',
    params: query
  });
}

export function deviceDetail(id) {
  return request({
    url: '/iot/device/' + id,
    method: 'get'
  });
}

// 新增设备列表
export function addDevice(params) {
  return request({
    url: '/iot/device',
    method: 'post',
    data: params
  });
}

// 修改设备列表
export function updateDevice(params) {
  return request({
    url: '/iot/device',
    method: 'put',
    data: params
  });
}


// 删除设备列表
export function deleteDevice(id) {
  return request({
    url: '/iot/device/' + id,
    method: 'delete'
  });
}

// 获取节目列表
export function programList(query) {
  return request({
    url: '/iot/program/list',
    method: 'get',
    params: query
  });
}


// 获取节目详情
export function programDeital(id) {
  return request({
    url: '/iot/program/' + id,
    method: 'get'
  });
}

// 新增节目列表
export function programAdd(data) {
  return request({
    url: '/iot/program',
    method: 'post',
    data
  });
}

// 修改节目列表
export function programUpdate(data) {
  return request({
    url: '/iot/program',
    method: 'put',
    data
  });
}


// 配置下发
export function programIssued(data) {
  return request({
    url: '/iot/program/issued',
    method: 'post',
    data
  });
}

// 删除节目
export function programDel(id) {
  return request({
    url: '/iot/program/' + id,
    method: 'delete'
  });
}

// 查询门禁关系
export function accessListRelationship(query) {
  return request({
    url: '/iot/device/accessList',
    method: 'get',
    params: query
  });
}

// 新增门禁关系
export function addAccessRelationship(data) {
  return request({
    url: '/iot/device/addAccess',
    method: 'post',
    data
  });
}

// 修改门禁关系
export function updateAccessRelationship(data) {
  return request({
    url: '/iot/device/updateAccess',
    method: 'put',
    data
  });
}

// 查询门禁用户
export function accessListUser(query) {
  return request({
    url: '/iot/device/accessUserList',
    method: 'get',
    params: query
  });
}

// 新增门禁关系
export function addAccessUser(data) {
  return request({
    url: '/iot/device/addAccessUser',
    method: 'post',
    data
  });
}

// 删除门禁用户
export function deleteAccessUser(data) {
  return request({
    url: '/iot/device/deleteAccessUser',
    method: 'delete',
    data
  });
}

// 一键关机
export function shutdownApp(query) {
  return request({
    url: '/iot/device/shutdownApp',
    method: 'get',
    params: query
  });
}

// 一键重启
export function rebootApp(query) {
  return request({
    url: '/iot/device/rebootApp',
    method: 'get',
    params: query
  });
}

// 设置开关机时间
export function setPowerOnOffAppTime(query) {
  return request({
    url: '/iot/device/setPowerOnOffApp',
    method: 'get',
    params: query
  });
}

//设置周期定时开关机
export function setPowerOnOffAppWeekNew(query) {
  return request({
    url: '/iot/device/setPowerOnOffAppWeek',
    method: 'get',
    params: query
  });
}

// 获取截屏
export function getTakeScreenshotAppPic(query) {
  return request({
    url: '/iot/device/getTakeScreenshotApp',
    method: 'get',
    params: query
  });
}